<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>v-bind与v-on的缩写</title>
</head>
<body>
<style>
    #app li {
        display: block;
        width: 50px;
        height: 50px;
        float: left;
        text-align: center;
        line-height: 50px;
        border: 1px solid #477343;
        border-left: 0;
    }

    #app a {
        display: block;
        width: 100%;
        height: 100%;
        cursor: pointer;
    }

    #app li:first-child {
        border-left: 1px solid #477343;

    }

    li .active {
        background: #477343;
    }

    [v-cloak] {
        display: none;
    }
</style>
<div id="app" v-cloak>
    <ul>
        <li v-for="p in pageSize">
            <!--<a v-bind:class="p===activeNumber?'active':''" v-on:click="goPageNumber(p)">{{p}}</a>-->
            <!--将v-bind缩写为：，v-on缩写为@-->
            <a :class="p===activeNumber?'active':''" @click="goPageNumber(p)">{{p}}</a>
        </li>
    </ul>
</div>

<script src="../modules/vue.js"></script>
<script>
    var appData = {
        activeNumber: 1,
        pageSize: 10
    }

    var vm = new Vue({
        el: '#app',
        data: appData,
        methods: {
            goPageNumber: function (pn) {
                appData.activeNumber = pn;
            }
        }

    });
</script>
</body>
</html>